#[cfg(test)]
mod test {
    use std::{env::consts::FAMILY, fs::File, io::{self, Read}, path};


    fn read_file_to_string(path: &str) ->Result<String,io::Error> {
        let mut file = File::open(path)?;
        let mut contents = String::new();
        file.read_to_string(&mut contents);
        Ok(contents)
    }
    #[test]
    fn main() {
        let path = "1.txt";
        match  read_file_to_string(path) {
            Ok(contents) => print!("文件内容：{}",contents),
            Err(e) => println!("读取文件失败{}",e),
        }
    }
}
